local weilie = fk.CreateSkill {

  name = "joy__weilie",

  tags = {  },

}



weilie:addEffect("active", {
  name = "joy__weilie",
  anim_type = "support",
  prompt = function ()
    local max_times = type(player:getMark("@$fuping")) == "table" and #player:getMark("@$fuping") or 0
    return "#joy__weilie-active:::" .. tostring(max_times - player:usedSkillTimes("weilie", Player.HistoryGame) + 1)
  end,
  can_use = function(self, player)
    local max_times = type(player:getMark("@$fuping")) == "table" and #player:getMark("@$fuping") or 0
    return player:usedSkillTimes(weilie.name, Player.HistoryGame)  <= max_times
  end,
  card_filter = function(self, to_select, selected, targets)
    return #selected == 0
  end,
  target_filter = function(self, player, to_select, selected)
    return #selected == 0 and Fk:currentRoom():getPlayerById(to_select):isWounded()
  end,
  target_num = 1,
  card_num = 1,
  on_use = function(self, room, effect)
    local from = effect.from
    room:throwCard(effect.cards, weilie.name, from, from)
    local target = effect.tos[1]
    room:recover({
      who = target,
      num = 1,
      recoverBy = from,
      skillName = weilie.name
    })
    if not target.dead then
      room:drawCards(target, 1, weilie.name)
    end
  end,
})

return weilie